package cn.itsource.aigo.web.controller;

import cn.itsource.aigou.domain.User;
import cn.itsource.util.AjaxResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class UserLoginController {

    @PostMapping("/login")
    public AjaxResult login(@RequestBody User user){
        String username = user.getUsername();
        String password = user.getPassword();
        if ("admin".equals(username)&&"123456".equals(password)){
            return AjaxResult.me().setSuccess(true).setMessage("登陆成功").setResultObj(user);
        }else {
            return AjaxResult.me().setSuccess(false).setMessage("登录失败");
        }
    }



}
